package day18;

import java.util.concurrent.locks.ReentrantLock;

public class Demo8 {
    ReentrantLock lock = new ReentrantLock();
    public void deadLock(){
        String name = Thread.currentThread().getName();
        System.out.println(name + " 尝试获取lock锁...");
        lock.lock();
        System.out.println(name+"获取到了lock锁...");
        //lock.unlock();
    }

    public static void main(String[] args) {
        Demo8 demo8 = new Demo8();
        new Thread(()->{
            demo8.deadLock();
        },"A").start();

        new Thread(()->{
            demo8.deadLock();
        },"B").start();

        new Thread(()->{
            demo8.deadLock();
        },"C").start();

    }
}
